<template>
	<view>
		  <view class="status_bar">
		            <!-- 这里是状态栏 -->
		        </view>
				<uni-nav-bar left-icon="left" @clickLeft="Back" title="导航栏组件"></uni-nav-bar>
		<uni-card :title="title">
			<view>
				<uni-table>
					<uni-tr>
						<uni-th width="80px">商品</uni-th>
						<uni-th width="80px">数量</uni-th>
						<uni-th>价格</uni-th>
					</uni-tr>
					<uni-tr v-for="detail in orderdetailList">
						<uni-td>{{detail.goodsName}}</uni-td>
						<uni-td>{{detail.goodsNum}}</uni-td>
						<uni-td>{{detail.goodspr}}¥</uni-td>
					</uni-tr>
					<uni-tr>
						<uni-td>总计</uni-td>
						<uni-td></uni-td>
						<uni-td>{{orderdetailList[0].money}}¥</uni-td>
					</uni-tr>
				</uni-table>
				<view><text>用户：{{consumer}}</text></view>
					<view><text>日期：{{date}}</text>
				</view>
			</view>
		</uni-card>
	</view>
</template>

<script>
	import {
		request
	} from '@/network/http.js'
	export default {
		data() {
			return {
				money:0,
				drderid:"",
				orderdetailList:[],
				title: "",
				consumer: "",
				date: "",
				

			}
		},
		onLoad(optioin) {
			this.orderId=optioin.id
			console.log(this.orderId)	
			request({
					url:`driver/ssmsj/getdetail/${this.orderId}`,
					method:'GET'
				}).then(res=>{
					this.orderdetailList=res.data.detailList
					this.title="订单号："+res.data.detailList[0].soId
					this.consumer=res.data.detailList[0].userName
					this.date=res.data.detailList[0].createTime
					
				})
		},
		onShow() {
			// request({
				// 	url:`driver/ssmsj/getdetail/${this.orderId}`,
				// 	method:'GET'
				// }).then(res=>{
				// 	this.orderdetailList=res.data.details
				// 	this.title="订单号："+res.data.orderdetailList[0].soId
				// 	this.consumer=res.data.orderdetailList[0].userName
				// 	this.date=res.data.orderdetailList[0].createTime
					
				// })
		},
		methods: {
		Back(){
			//uni.navigateBack()//默认delta:1
			uni.navigateBack({
				delta:1,//返回层数，2则上上页
			})
		}
		}
	}
</script>

<style>
	   .status_bar {
	        height: var(--status-bar-height);
	        width: 100%;
	    }
</style>
